package com.jintoufs.dao.sys.impl;

import com.jintoufs.dao.MyBatisSupport;
import com.jintoufs.dao.QueryFilters;
import com.jintoufs.dao.sys.DictionaryDAO;
import com.jintoufs.domain.sys.Dictionary;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 数据字典
 */
@Repository
public class DictionaryDAOImpl extends MyBatisSupport<DictionaryDAO, Dictionary> implements DictionaryDAO {
    @SuppressWarnings("serial")
    private static Map<String, Object> fildMap = new HashMap<String, Object>() {
        {
            put("id", "id");
            put("keyNo", "key_no");
            put("keyValue", "key_value");
            put("caption","caption");
        }
    };

    @Override
    public Integer update(Dictionary entity) {
        return getMapper().update(entity);
    }

    @Override
    public Integer insert(Dictionary entity) {
        return getMapper().insert(entity);
    }

    @Override
    public void delete(Integer id) {
        getMapper().delete(id);
    }

    @Override
    public List<Dictionary> getByFilter(QueryFilters filters) {
        filters.format(fildMap);
        return getMapper().getByFilter(filters);
    }

    @Override
    public List<Dictionary> getDicByKeyNo(String keyNo) {
        return getMapper().getDicByKeyNo(keyNo);
    }

    @Override
    public List<Dictionary> getByParams(Map<String, Object> params1) {
        return getMapper().getByParams(params1);
    }

    @Override
    public List<Dictionary> queryPlatformsByTaskId(Long taskId) {
        return getMapper().queryPlatformsByTaskId(taskId);
    }

}
